<?php

namespace app\lnk\middleware;

use lite\lib\JwtAuth;

class NoLogin
{
    public function handle($request, \Closure $next)
    {
        
        $token = $request->header('token');
        if (!$token) return $next($request);

        $check_token = JwtAuth::checkToken($token);
        if ($check_token['code'] == 1) {
            $request->uid = $check_token['data'];

            return $next($request);
        } else {
            return $next($request);
        }
    }
}